package cn.bearspark.sms.enumeration;

import cn.bearspark.common.dto.ResponseDTO;

/**
 * 短信模块的失败响应的枚举类
 *
 * @author f
 */
public enum SmsFailRespEnum {
    FREQUENT_SMS(301, "短信发送过于频繁"),
    CODE_EXPIRE_OR_INCORRECT(302, "验证码过期或错误");

    /**
     * 返回一个 T 类型的失败响应
     */
    public <T> ResponseDTO<T> response() {
        return ResponseDTO.fail(this.code, this.msg);
    }

    private final int code;
    private final String msg;

    SmsFailRespEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}
